package com.tjn;

/**
 * @author 陶镓妮
 * @version 1.0
 */
public class Exercise03 {
    public static void main(String[] args) {
        String name = "Tao Jia Ni";
        printName(name);
    }

    public static void printName(String name){
        String[] s = name.split(" ");
        if(s.length != 3){
            System.out.println("输入姓名格式有误");
            return;
        }

        String temp = " ";
        temp = s[0];
        s[0] = s[2];
        s[2] = temp;
        String s1 = s[1].toUpperCase();
        char[] chars = s1.toCharArray();
        System.out.println(s[0] + "." +s[2] + "." + chars[0]);

        //更简便的方法：
        //String.format("%s.%s.%s", s[2], s[0], s[1].toUpperCase().charAt(0));//charAt是获取某索引处的字符
    }
}
